Skip to content

Fix completion to show both property and extension method with same name#81248

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/fix-completion-extension-methods
Draft

Fix completion to show both property and extension method with same name#81248
Copilot wants to merge 3 commits intomainfrom
copilot/fix-completion-extension-methods

Conversation

Copy link
Contributor

Copilot AI commented Nov 14, 2025

Completion was merging properties and extension methods with identical names into a single item, hiding one of them from users.

using NS1;

var x = new MyClass();
x.$$  // Previously showed only one "MyMember", now shows both

namespace NS1
{
    public class MyClass
    {
        public int MyMember { get; set; }
    }

    public static class Extensions
    {
        public static MyClass MyMember(this MyClass c) => c;
    }
}

Changes

  • Modified AbstractSymbolCompletionProvider.CreateItems to include isMethod in the grouping key: (displayText, suffix, insertionText, isMethod)
  • This separates methods from non-methods (properties, fields, events) when grouping symbols with identical display text
  • Added test case verifying both items appear in completion

Fixes #78766

Original prompt

This section details on the original issue you should resolve

<issue_title>Completion doesn't show extension methods if there is a property with the same name</issue_title>
<issue_description>```csharp
using NS1;

var x = new MyClass();
x.$$ // Should show both MyMember property and MyMember extension method

namespace NS1
{
public class MyClass
{
public int MyMember { get; set; }
}

public static class Extensions
{
    public static MyClass MyMember(this MyClass c)
        => c;
}

}


<agent_instructions>@copilot my guess is that we're finding both items, but then merging them in the SymbolCompletionProvider (or base type) into a single member based on name alone.  We should see if one is a method, and one is not, and try to not merge them in that case.

Note: we may have the symbols still (in which can you can check what they are).  Or we may have lost htat info, and we may need to use something like the glyph info to make this determination.  See if you can find a simple way to solve this.</agent_instructions>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Modified CreateItems in AbstractSymbolCompletionProvider to include whether a symbol
is a method in the grouping key. This prevents properties and extension methods with
the same name from being merged into a single completion item.

Added test case to verify the fix.

Co-authored-by: CyrusNajmabadi <4564579+CyrusNajmabadi@users.noreply.github.com>
Co-authored-by: CyrusNajmabadi <4564579+CyrusNajmabadi@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix completion issue with extension methods and properties Fix completion to show both property and extension method with same name Nov 14, 2025
Copilot AI requested a review from CyrusNajmabadi November 14, 2025 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

2 participants